<template>
	<div id="app">
		<transition name="fade" mode="out-in">
			<router-view v-if="isRouterAlive"></router-view>
		</transition>
	</div>
</template>

<script>
export default {
	name: 'app',
	provide() {
		return {
			reload: this.reload
		}
	},
	data() {
		return {
			isRouterAlive: true
		}
	},
	methods: {
		reload() {
			this.isRouterAlive = false
			this.$nextTick(function() {
				this.isRouterAlive = true
			})
		}
	},
	created() {
		//在页面加载时读取sessionStorage里的状态信息
		if (sessionStorage.getItem("store") ) {
			this.$store.replaceState(Object.assign({}, this.$store.state,JSON.parse(sessionStorage.getItem("store"))))
		}

		//在页面刷新时将vuex里的信息保存到sessionStorage里
		window.addEventListener("beforeunload",()=>{
			sessionStorage.setItem("store",JSON.stringify(this.$store.state))
		})
	},
}

</script>

<style lang="scss">
@charset "UTF-8";

@font-face {
  font-family: 'SourceHanSansJP';
  src: url("SourceHanSans-Light.otf");
  font-weight: normal;
  font-style: normal;
}

body {
	margin: 0px;
	padding: 0px;
	/*background: url(assets/bg1.jpg) center !important;
		background-size: cover;*/
	// background: #1F2D3D;
	// font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, SimSun, sans-serif;
	font-family: SourceHanSansJP !important;
	font-size: 14px;
	-webkit-font-smoothing: antialiased;
}

#app {
	position: absolute;
	top: 0px;
	bottom: 0px;
	width: 100%;
}
.el-input__inner{
	font-family: SourceHanSansJP !important;
}
.el-button{
	font-family: SourceHanSansJP !important;
}
.el-menu-item-group__title{
  padding: 0px
}
.el-menu--popup{
  padding: 0px
}
.el-menu-vertical-demo:not(.el-menu--collapse) {
    width: 200px;
    min-height: 400px;
  }
.el-submenu [class^=fa] {
	vertical-align: baseline;
	margin-right: 10px;
}
.el-form-item__content{
	line-height: 20px;
}

.el-menu-item [class^=fa] {
	vertical-align: baseline;
	margin-right: 10px;
}
.toolbar {
	background: #f2f2f2;
	padding: 10px;
	//border:1px solid #dfe6ec;
	margin: 10px 0px;
	.el-form-item {
		margin-bottom: 10px;
	}
}
.el-card__body{
  padding: 0px
}
.fade-enter-active,
.fade-leave-active {
	transition: all .2s ease;
}

.fade-enter,
.fade-leave-active {
	opacity: 0;
}
.deleteStr{
	font-size:14px;
	position:absolute;
	top:50%;
	transform:translateY(-50%);
	right:10px;
	cursor: pointer;
}
</style>
